package com.bio.dao.call.impl;

import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;

import com.bio.dao.call.HistoryDao;
import com.bio.dao.impl.HibernateDaoImpl;
import com.bio.dao.impl.HibernateQuery;
import com.bio.entity.call.History;
import com.bio.utils.Pager;
import com.bio.utils.Pagination;

public class HistoryDaoImpl extends HibernateDaoImpl<History> implements HistoryDao{

	@Override
	public Pager<History> findPagerByCallId(Pagination pagination, Long callId) {
		return new HibernateQuery<History>(this.getSessionFactory(), 
				this.getSession(), History.class).setPagination(pagination)
					                              .addWhere(Restrictions.eq("callId",callId)).addOrder(Order.desc("id")).query();
	}
}
